package cn.sitcat.controller;

import cn.sitcat.entity.maria.User;
import cn.sitcat.service.mysql.MysqlService;
import cn.sitcat.service.maria.MariaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author liusong
 * @date 2019/6/17 11:31
 * @desc
 */
@Controller
@RestController
public class HelloController {
    @Autowired
    private MysqlService mysqlService;

    @Autowired
    private MariaService mariaService;

    @RequestMapping("/")
    @ResponseBody
    public Map<String, Object> hello() {
        List<cn.sitcat.entity.mysql.User> deptList = mysqlService.getUserList();
        System.out.println("UserList01==========" + deptList.toArray());
        for (cn.sitcat.entity.mysql.User user : deptList) {
            System.out.println(user);
        }
        List<User> userList = mariaService.getUserList();
        Map<String, Object> resultMap = new HashMap<>();
        resultMap.put("deptList", deptList);
        resultMap.put("userList", userList);
        System.out.println("userList02==========" + userList.toArray());
        for (User user : userList) {
            System.out.println(user);
        }
        return resultMap;
    }
}
